{extend name="/fool" /}
{block name="css"}
<link rel="stylesheet" href="/css/admin/assets.css">
<style>
    #page{
        position: relative;
        display: inline-block;
        left:30%;
        margin-left:-50px;
        padding:50px 0;
    }
    #title_one{
        font-size: 15px;
        line-height: 30px;
        border-bottom: 1px solid rgba(0,0,0,0.5);
    }
    #title_two{
        margin-bottom: 100px;
    }
    #title_two li{
        width:30vw;
        float: left;
    }
    .title_two_title{
        font-size: 16px;
        line-height: 50px;
    }
    .title_two_num{
        font-size: 18px;
        color:#2A86FE;
    }
</style>
{/block}
{block name="menu_content"}
<div style="width:94vw;margin-left: 3vw;">
    <div id="title_one">服务中心流水账</div>
    <div id="title_two">
        <ul>
            <li>
                <div class="title_two_title">服务中心总余额</div>
                <div class="title_two_num">{$ptsy}</div>
            </li>
        </ul>
    </div>
    <div style="padding-left: 10px;">
        收支记录
    </div>
    <div id="one">
        <form class="layui-form" action="" method="post">
            <ul>
                <li>
                    <div class="layui-input-inline">
                        <input type="text" name="time" class="layui-input" id="test1" placeholder="开始时间 至 结束时间">
                    </div>
                    <button type="Submit" class="layui-btn">筛选</button>
                </li>
            </ul>
        </form>
    </div>
    <div>
        <table>
            <tr>
                <th>ID</th>
                <th>服务中心名称</th>
                <th>商铺名称</th>
                <th>租赁人名称</th>
                <th>交易单号</th>
                <th>返利金额</th>
                <th>账户余额</th>
                <th>添加时间</th>
            </tr>
            {if isset($list)}
            {foreach $list as $v}
            <tr>
            	<td>{$v.id}</td>
            	<td>{$v.user.fwgl.name}</td>
            	<td>
            		{if isset($v.busname)}
            		{$v.busname}
            		{/if}
            	</td>
            	<td>{$v.pids.name}</td>
            	<td>{$v.orderid}</td>
            	<td>{$v.money}</td>
            	<td>{$v.balance}</td>
            	<td>{$v.create_time}</td>
            </tr>
            {/foreach}
            {/if}
        </table>
        <div id="page">
        </div>
    </div>
</div>
<script>
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            return false;
        });
    });
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#test1'
            ,type: 'month'
            ,range: '至'
            ,format: 'yyyy-MM'
        });
    });
    $(".viewbu").click(function(){
        var id = $(this).attr('sid');
        var url = "{:url('view',['id'=>'6','index'=>'1'])}" + '&view=' + '3' + '&battery_order=' + id;
        console.log(url);
        location.href = url;
    })
    layui.use('laypage', function(){
        var laypage = layui.laypage;
        //执行一个laypage实例
        laypage.render({
            elem: 'page'
            ,count: "{$count}"
            ,curr:"{$curl}"
            ,last:"{$groups}"
            ,limit:"{$limit}"
            ,layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']
            ,jump: function(obj,first){
                console.log(obj)
                if(!first){
                    var url = "{:url('index',['id'=>5,'index'=>0])}" + '&page=' + obj.curr + '&limit=' + obj.limit + '&curr=' + obj.curr;
                    location.href = url;
                }
            }
        });
    });
</script>
{/block}